﻿using System;
using System.Windows.Data;
using System.Globalization;

namespace OverlakeApp.Converters
{
    /// <summary>
    /// Converts a string to upper case.
    /// </summary>
    public class ToUpperConverter : IValueConverter
    {
        /// <summary>
        /// Converts <paramref name="value"/> to an upper case string.
        /// </summary>
        /// <param name="value">The string to convert.</param>
        /// <param name="targetType">Not used.</param>
        /// <param name="parameter">Not used.</param>
        /// <param name="culture">The culture by which the string is converted.</param>
        /// <returns>The culture-specific upper case string.</returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is String)
                return (value as string).ToUpper(culture);

            return null;
        }

        /// <summary>
        /// Not implemented.
        /// </summary>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
